#include <iostream>
#include <vector>
#include <stdlib.h>//srand(),rand()
#include <sys/time.h>

using namespace std;

const long VECSIZE = 7000000;

vector<int> vec(VECSIZE, 10);

inline int getValues (int& idx )
{
	return vec[idx];
}

inline vector<int>& getVector ()
{
	return vec;
}

int r (int& x)
{
	return x;
}

int main ()
{
	timeval starttime,endtime;
	long int timeuse;
	int i = 0, tmp;
	
	gettimeofday(&starttime,0);
	while ( i++ < VECSIZE )
	{
		tmp = getValues(i);
	}
	gettimeofday(&endtime,0);
	timeuse = 1000000*(endtime.tv_sec - starttime.tv_sec) + endtime.tv_usec - starttime.tv_usec;
	cout << timeuse << " us" << endl;
	
	
	gettimeofday(&starttime,0);
	while ( i-- > 0 )
	{
		tmp = getVector()[i];
	}
	gettimeofday(&endtime,0);
	timeuse = 1000000*(endtime.tv_sec - starttime.tv_sec) + endtime.tv_usec - starttime.tv_usec;
	cout << timeuse << " us" << endl;
	
	cout << r (i) << endl;
	cout << i << endl;

	return 0;
}
